local star_box = Obstacle:addState("star_box")

function star_box:enteredState()
	print("entered obstacle state star_box")
	self.name = "star_box"
	self.collision_move = false
	self.return_collision_move = false
	self.collision_move_dist = 32
	self.collision_move_velocity = 500
	self.collision_move_total = 0
	self.collision_move_origin_y = self.y
end

function star_box:on_collision(collider, direction)

	if direction == "down" then
		self.collision_move = true
	end
end

function star_box:update(dt)

	if self.collision_move then
		local dist = self.collision_move_velocity*dt
		self.y = self.y - dist
		self.collision_move_total = self.collision_move_total + dist
		if self.collision_move_total >= self.collision_move_dist then
			self.collision_move = false
			self.collision_move_total = 0
			self.return_collision_move = true
		end
	end

	if self.return_collision_move then
		local dist = self.collision_move_velocity*dt
		self.y = self.y + dist
		self.collision_move_total = self.collision_move_total + dist
		if self.collision_move_total >= self.collision_move_dist then
			self.y = self.collision_move_origin_y
			self.return_collision_move = false
			self.collision_move_total = 0
		end
	end

end

function star_box:exitedState()
	print("exited obstacle state star_box")
end